home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 55
/
Amiga_Dream_55.iso
/
RISCOS
/
APPS
/
TEXT
/
PS
/
KIT-PS.ZIP
/
Kit PS
/
!PSUtils
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1997-02-20
|
58KB
|
2,275 lines
!PsUsils - Front end to psutils package.
Frontend (C) Graham Jones, 1995
Psutils package (C) Angus Duggan
memory(
Next initialise the application with the WIMP, giving the task name,
sprite name and selecting buffer size of 1024.
font_init
grj_wimp_init("PSUtils Frontend","!psutils",
,2048,200,0)
Set up out error trap :
grj_update_bartext( "Psnup" )
wimp_error(1,
$+" at line "+
wimp_quit
Setup various variables
CL$(6):
6 command lines
wins%(6), psize%(6,2), custom_page%(6,2,2):
pane% 2048
pages%(20,5)
pagespecs% =
malloc(24)
psnupwin%=0
pstopswin%=1
psbookwin%=2
epsffitwin%=3
psresizewin%=4
psselectwin%=5
config_name$ = ""
config_on_save% =
curr_selection% = psnupwin%
infile$ = ""
psize%(psnupwin%,0) = 1
psize%(psnupwin%,1) = 1
psize%(pstopswin%,0) = 1
psize%(psresizewin%,0) = 1
psize%(psresizewin%,1) = 1
size_win% = -1
nup_win% = -1
big_page_open% =
pw% = 0: ph% = 0: sc = 1.0
mag% = 1: div% = 1
flags_off% = 4
scale_off% = 5
xoff_off% = 10
yoff_off% = 15
fl% = %00000001
fr% = %00000010
fu% = %00000100
fsc% = %00001000
fplus% = %00010000
fend% = %00100000
foff% = %01000000
I%=0
J% = 0
A# custom_page%(I%, J%, 0)=595
B# custom_page%(I%, J%, 1)=842
Next initialise the templates routines. This takes no parameters.
win_init(10)
PROCfont_init
JHtrin% =
font_gethandle("Trinity.Medium", 12, 12) :
Lets try this
temp_init
transfer_init
create_windows
setup_menus
setup_windows
mid_save% =
saving%=
drag_action% = 1
psnup_CL
pstops_CL
epsffit_CL
psbook_CL
psresize_CL
psselect_CL
wimp_poll(0,0,0)
Never reached but it doesn't feel right not being there!
wimp_mainmenu
create_windows
Now we can read the application's templates file :
temp_readfile("<PSUtils$Dir>.Templates",2600)
n$ info% =
win_createwin("Info")
oB psnup% =
win_createwin("PSNup") : wins%(psnupwin%) = psnup%
pF pstops% =
win_createwin("PsToPs") : wins%(pstopswin%) = pstops%
qJ epsffit% =
win_createwin("EpsfFit") : wins%(epsffitwin%) = epsffit%
rF psbook% =
win_createwin("PsBook") : wins%(psbookwin%) = psbook%
sN psresize% =
win_createwin("PsResize") : wins%(psresizewin%) = psresize%
tN psselect% =
win_createwin("PsSelect") : wins%(psselectwin%) = psselect%
u) savewin% =
win_createwin("SaveAs")
v, topspane% =
win_createwin("toPsPane")
w0 pstopsedit% =
win_createwin("PstoPsEdit")
get_pagesize(pstopswin%, 0, 5, pw%, ph%)
z7 sc = 216/pw%: sc1 = 184/ph%:
(sc1 < sc) sc = sc1
pw% = pw% * sc: ph% = ph% * sc
win_resize(topspane%, pw%*sc, ph%*sc)
win_closewin(topspane%)
setup_psnup
icon_shade(psnup%,5)
icon_shade(psnup%,6)
icon_settext(psnup%, 25, "A4")
icon_shade(psnup%,3)
icon_shade(psnup%,4)
icon_settext(psnup%, 26, "A4")
icon_shade(psnup%,8)
icon_shade(psnup%,9)
icon_shade(psnup%,10)
icon_shade(psnup%,11)
get_pagesize( psnupwin%, 0, 5, X%, Y% )
icon_settext(wins%(psnupwin%), 5,
(X%))
icon_settext(wins%(psnupwin%), 6,
(Y%))
get_pagesize( psnupwin%, 1, 3, X%, Y% )
icon_settext(wins%(psnupwin%), 3,
(X%))
icon_settext(wins%(psnupwin%), 4,
(Y%))
setup_pstops
icon_shade(pstops%,5)
icon_shade(pstops%,6)
icon_settext(pstops%, 3, "A4")
icon_shade(pstops%,10)
get_pagesize( pstopswin%, 0, 5, X%, Y% )
icon_settext(wins%(pstopswin%), 5,
(X%))
icon_settext(wins%(pstopswin%), 6,
(Y%))
setup_epsffit
setup_psbook
setup_psresize
icon_shade(psresize%,5)
icon_shade(psresize%,6)
icon_settext(psresize%, 3, "A4")
get_pagesize( psresizewin%, 0, 5, X%, Y% )
icon_settext(wins%(psresizewin%), 5,
(X%))
icon_settext(wins%(psresizewin%), 6,
(Y%))
icon_shade(psresize%,13)
icon_shade(psresize%,14)
icon_settext(psresize%, 10, "A4")
get_pagesize( psresizewin%, 1, 13, X%, Y% )
icon_settext(wins%(psresizewin%), 13,
(X%))
icon_settext(wins%(psresizewin%), 14,
(Y%))
setup_psselect
setup_windows
setup_psnup
setup_pstops
setup_epsffit
setup_psbook
setup_psresize
setup_psselect
setup_menus
this_name$, i%
Next initialise the menu library, stating that we intend to have
2 menus (we can change this value later if more are needed).
menu_init(3)
Create the first (number 0) menu, giving it a title of "Test App" and
giving it 3 entries :
menu_header("PsUtils",0,8)
menu_header("",1,1)
menu_header("Page sizes",2,14)
Now create the 3 entries, one being "Info", the second "Sub Menu"
and the third "Quit".
menu_additem(0,0,"Info",menu_dotted)
menu_additem(0,2,"Ps to Ps",0)
menu_additem(0,1,"Ps Nup",menu_tick)
menu_additem(0,3,"Ps Book",0)
menu_additem(0,4,"Epsf Fit",0)
menu_additem(0,5,"Ps Resize",0)
menu_additem(0,6,"Ps Select",menu_dotted)
menu_additem(0,7,"Quit",0)
menu_additem(1,0,"Configure",0)
i% = 1
menu_submenu(0,i%,1)
menu_subwindow(0,0,info%)
menu_additem(2,0,"Custom",menu_dotted)
i% = 1
# this_name$ =
page_name(i%)
@ this_name$ =
toupper(
this_name$, 1)) +
this_name$, 2)
(
menu_additem(2,i%,this_name$,0)
event_menuselection(B%)
Find out what entry in the first menu was selected
_wimp_oldmenu%=0
!B%
2 curr_selection% = curr_selection%
A
7:
Sub menu, follow it down
wimp_quit
#
pstops_menu(!B%, B%!4)
,
_wimp_oldmenu% = 2
page_menu(!B%)
page_menu(sel%)
X%,Y%
new_nup% = sel%
resize_in% = 0
to_shade% = 5
show_size% = 3
real_win% = size_win%
((size_win% < 0)
(real_win% = -psresize%))
real_win% = -size_win%
resize_in% = 1
to_shade% = 13
show_size% = 10
5
((size_win% < 0)
(real_win% = -psnup%))
real_win% = -size_win%
resize_in% = 1
to_shade% = 3
show_size% = 25
(real_win% = psnup%)
show_size% = 26
* this_win% =
which_winnum(real_win%)
menu_untick(2, psize%(this_win%,resize_in%))
- psize%(this_win%,resize_in%) = new_nup%
menu_tick(2, psize%(this_win%,resize_in%))
psize%(this_win%,resize_in%)=0
,
Un-grey out the width/height boxes
1
icon_unshade(wins%(this_win%),to_shade%)
3
icon_unshade(wins%(this_win%),to_shade%+1)
/
icon_shade(wins%(this_win%),to_shade%)
!1
icon_shade(wins%(this_win%),to_shade%+1)
psize%(this_win%,resize_in%) = 0
%3 X% = custom_page%(this_win%, resize_in%, 0)
&3 Y% = custom_page%(this_win%, resize_in%, 1)
'=
icon_settext(wins%(this_win%), show_size%, "Custom")
(9
icon_settext(wins%(this_win%), to_shade%,
(X%))
);
icon_settext(wins%(this_win%), to_shade%+1,
(Y%))
+= this_name$ =
page_name(psize%(this_win%,resize_in%))
,A this_name$ =
toupper(
this_name$, 1)) +
this_name$, 2)
-?
icon_settext(wins%(this_win%), show_size%, this_name$)
.A
Get the page size and put it into the appropriate icons
/A
get_pagesize( this_win%, resize_in%, to_shade%, X%, Y% )
09
icon_settext(wins%(this_win%), to_shade%,
(X%))
1;
icon_settext(wins%(this_win%), to_shade%+1,
(Y%))
pstops_menu(sel%, sub%)
X%,Y%,x%,y%
There is only one menu item on the submenu and it must have been clicked.
(sub% = -1)
;*
menu_untick(0, curr_selection%+1)
<$ curr_selection% = (sel%) - 1
=(
menu_tick(0, curr_selection%+1)
curr_selection%
psnupwin%:
@(
grj_update_bartext("PsNup")
pstopswin%:
B)
grj_update_bartext("PsToPs")
epsffitwin%:
D*
grj_update_bartext("EpsfFit")
psresizewin%:
F+
grj_update_bartext("PsResize")
psbookwin%:
H)
grj_update_bartext("PsBook")
psselectwin%:
J+
grj_update_bartext("PsSelect")
K
which% = sel%-1
N;
(big_page_open%)
(which% = wins%(pstopswin%))
O)
win_getsize(wins%(which%),x%,y%)
os_screensize(X%,Y%)
Q9
win_movewin(wins%(which%),(X%-x%)
2,(Y%-y%)
R& !B%=
win_handle(wins%(which%))
&400CB,,B%
B%!28 = -1
&400C5,,B%
call_setup(which%)
call_setup(num%)
num%
psnupwin%:
psnup_setup
pstopswin%:
pstops_setup
epsffitwin%:
epsffit_setup
psbookwin%:
psbook_setup
psresizewin%:
psresize_setup
psselectwin%:
psselect_setup
call_CL(num%)
num%
psnup%:
psnup_CL
pstops%:
pstops_CL
epsffit%:
epsffit_CL
psbook%:
psbook_CL
psresize%:
psresize_CL
psselect%:
psselect_CL
event_iconbaradjust(B%)
}4 new_selection% = ((curr_selection%+1)
6) + 1
pstops_menu( new_selection%, -1 )
event_iconbarselect(B%)
X%,Y%,x%,y%,xmin%,ymin%,xmax%,ymax%
saving% =
=
(big_page_open%)
(curr_selection% = pstopswin%)
2
win_getsize(wins%(curr_selection%),x%,y%)
os_screensize(X%,Y%)
F
win_getextent(wins%(curr_selection%),xmin%,ymin%,xmax%,ymax%)
B
win_movewin(wins%(curr_selection%),(X%-x%)
2,(Y%-y%)
/ !B%=
win_handle(wins%(curr_selection%))
&400CB,,B%
B%!28 = -1
&400C5,,B%
$
call_setup(curr_selection%)
transfer_willload(type%, open%)
(
(type% = &FF5)
(open% =
0
if it's PostScript and not a dataopen
=
=
ENDFN
transfer_loadfile(name$, type%, is_safe%)
x%,y%,z%,w%,h%
infile$ = name$
icon_settext(savewin%, 2, infile$)
Do a save drag to get an output filename, then get all the PSNup options set and call
the program
x%,y%,z%
win_getsize(savewin%,w%,h%) :
Get window size into x%,y%
win_movewin(savewin%,x%, y%)
icon_setcaret(savewin%, 2, -1)
saving% =
savewin_click(icon%, but%)
Just got a mouse click, now check for a drag with it.
(icon%=0)
((but% = 16)
(but% = 64))
N
transfer_startdrag(
icon_gettext(savewin%, 2), &FF5, 10, savewin%, 0)
icon%=1
,
Check the file has a path with it.
- outfile$ =
icon_gettext(savewin%, 2)
outfile$, ".") = 0
h hello%=
wimp_messagebox(
, "Warning from PSUtils","Drag the file icon to a directory to save")
&
if it has then save the file
>
otherwise pop up a warning window and tell the user.
-
transfer_savefile(outfile$, &FF5, 0)
(
but%=4
win_closewin(savewin%)
click_ok(win%, but%)
which_win%
Any of the config windows.
% which_win% =
win_findwin(win%)
call_CL(which_win%)
(which_win% = pstops%)
(but% = 1)
0
win_resize(topspane%, pw%*sc, ph%*sc)
' !pane% =
win_handle(pstops%)
*
"Wimp_GetWindowState",, pane%
1
"Wimp_SendMessage", 2, pane%, !pane%
#
win_redrawwin(topspane%)
mid_save%
9
which_winnum(which_win%) = curr_selection%)
mid_save% =
3
transfer_savefile(config_name$, &FF5, 0)
0
Call the PROC to save the file .....
(but% = 4)
!
win_closewin(which_win%)
8
(which_win% = pstops%)
win_closewin(topspane%)
page_click(win%, but%, icon%)
but% <> 0
x%,y%,z%
resize% =
nup% =
;
win_findwin(win%) = psresize%)
(icon%=15))
resize% =
( new_win% = -
win_findwin(win%)
new_real% = -new_win%
new_resize% = 1
:
win_findwin(win%) = psnup%)
(icon%=29))
resize% =
* new_win% = -
win_findwin(win%)
! new_real% = -new_win%
new_resize% = 1
) new_win% =
win_findwin(win%)
new_real% = new_win%
new_resize% = 0
resize_in% = 0
real_win% = size_win%
(size_win% < -1)
real_win% = -size_win%
resize_in% = 1
W
(real_win% <> -1)
menu_untick(2, psize%(
which_winnum(real_win%),resize_in%))
size_win% = new_win%
real_win% = new_real%
C
menu_tick(2, psize%(
which_winnum(real_win%),new_resize%))
menu_popup(2, x%,y%)
psnup_click(B%)
(B%!16=12)
(B%!16=29)
%
page_click(B%!12,B%!8,B%!16)
icon% = B%!16
M
Put any other checks before this section 'cos it doesn't check icon
3
number before getting in there and acting
.
icon_getselect( psnup%, icon% ))
0
(icon%=13)
icon_unshade( psnup%,8 )
.
(icon%=14)
icon_unshade(psnup%,9)
/
(icon%=19)
icon_unshade(psnup%,10)
/
(icon%=20)
icon_unshade(psnup%,11)
,
(icon%=13)
icon_shade(psnup%,8)
,
(icon%=14)
icon_shade(psnup%,9)
-
(icon%=19)
icon_shade(psnup%,10)
-
(icon%=20)
icon_shade(psnup%,11)
pstops_click(B%)
(B%!16=12)
%
page_click(B%!12,B%!8,B%!16)
icon% = B%!16
M
Put any other checks before this section 'cos it doesn't check icon
3
number before getting in there and acting
/
icon_getselect( pstops%, icon% ))
2
(icon%=11)
icon_unshade( pstops%,10 )
0
(icon%=11)
icon_shade( pstops%,10 )
epsffit_click(B%)
psbook_click(B%)
psresize_click(B%)
(B%!16=12)
(B%!16=15)
+%
page_click(B%!12,B%!8,B%!16)
psselect_click(B%)
event_mouseclick(B%)
B%!12=
win_handle(savewin%)
savewin_click(B%!16, B%!8):
IF (FNwin_findwin(B%!12) = topspane%) PROCopen_bigpage: ENDPROC
B%!16=1
click_ok(B%!12, B%!8):
win_findwin(B%!12)
psnup%:
psnup_click(B%)
pstops%:
pstops_click(B%)
epsffit%:
epsffit_click(B%)
psbook%:
psbook_click(B%)
psresize%:
psresize_click(B%)
psselect%:
psselect_click(B%)
topspane%:
open_bigpage
WHEN pstopsedit%:
PROCbigpage_click(B%)
open_bigpage
x%, y%, X%, Y%
big_page_open% =
win_closewin(pstops%):
win_closewin(topspane%)
get_pagesize(pstopswin%, 0, 5, x%, y%)
win_setextent(pstopsedit%, 0, -y%*mag%/div%, x%*mag%/div%, 0)
win_resize(pstopsedit%, x%*mag%/div%, y%*mag%/div%)
os_screensize(X%,Y%)
win_movewin(pstopsedit%,(X%-x%)
2,(Y%-y%)
transfer_savefile(name$, type%, safe%)
saving%=
win_closewin(savewin%)
saving%=
config_on_save%
[2
win_getsize(wins%(curr_selection%),x%,y%)
os_screensize(X%,Y%)
]B
win_movewin(wins%(curr_selection%),(X%-x%)
2,(Y%-y%)
^$
call_setup(curr_selection%)
config_name$ = name$
mid_save% =
a
hello% = FNwimp_messagebox(FALSE, "Command line", CL$(curr_selection%)+" "+infile$+" "+name$)
"Wimp_StartTask",CL$(curr_selection%)+" "+infile$+" "+name$
"OS_File",18,name$,&FF5
psnup_CL
the selections
lscape$, seascape$, swap$, cols$, sheet$, page$, border$, scale$
outsize$, pages$, insize$
Get the variables to the command line
icon_getselect(psnup%, 15) lscape$ = " -l"
lscape$=""
icon_getselect(psnup%, 16) seascape$ = " -r"
seascape$=""
icon_getselect(psnup%, 17) swap$ = " -f"
swap$=""
icon_getselect(psnup%, 18) cols$ = " -c"
cols$=""
icon_getselect(psnup%, 19) border$ = " -d"+
icon_gettext(psnup%, 10)
border$=""
icon_getselect(psnup%, 20) scale$ = " -s"+
icon_gettext(psnup%, 11)
scale$=""
icon_getselect(psnup%, 13) sheet$ = " -m"+
icon_gettext(psnup%, 8)
sheet$=""
icon_getselect(psnup%, 14) page$ = " -b"+
icon_gettext(psnup%, 9)
page$=""
w- pages$ = " -"+
icon_gettext(psnup%, 27)
pages$ = " -" pages$=""
Graham - save the custom size here, if a custom on selected
psize%(psnupwin%,0) = 0
}0
get_pagesize( psnupwin%, 0, 5, X%, Y% )
~* custom_page%(psnupwin%, 0, 0) = X%
* custom_page%(psnupwin%, 0, 1) = Y%
* outsize$ = " -w"+
(X%)+" -h"+
8 outsize$ = " -p"+
page_name(psize%(psnupwin%,0))
Graham - save the custom size here, if a custom one is selected
psize%(psnupwin%,1) = 0
0
get_pagesize( psnupwin%, 1, 3, X%, Y% )
* custom_page%(psnupwin%, 1, 0) = X%
* custom_page%(psnupwin%, 1, 1) = Y%
) insize$ = " -W"+
(X%)+" -H"+
7 insize$ = " -P"+
page_name(psize%(psnupwin%,1))
w CL$(psnupwin%) = "psnup "+outsize$+insize$+lscape$+seascape$+swap$+cols$+page$+sheet$+border$+scale$+pages$+" -q"
Only needs the files now
pstops_CL
the selections
border$, size$, pages$, bind$
Get the variables to the command line
icon_getselect(pstops%, 9) bind$ = " -b"
bind$=""
icon_getselect(pstops%, 11) border$ = " -d"+
icon_gettext(pstops%, 10)
border$=""
- pages$ = " "+
icon_gettext(pstops%, 13)
pages$ = " " pages$=" Default!!!!"
psize%(pstopswin%,0) = 0
1
get_pagesize( pstopswin%, 0, 5, X%, Y% )
+ custom_page%(pstopswin%, 0, 0) = X%
+ custom_page%(pstopswin%, 0, 1) = Y%
' size$ = " -w"+
(X%)+" -h"+
6 size$ = " -p"+
page_name(psize%(pstopswin%,0))
B CL$(pstopswin%) = "pstops "+size$+bind$+border$+" -q"+pages$
pagespecs(pages$)
get_pagesize(pstopswin%, 0, 5, pw%, ph%)
7 sc = 216/pw%: sc1 = 184/ph%:
(sc1 < sc) sc = sc1
pw% = pw% * sc: ph% = ph% * sc
epsffit_CL
c$,r$,a$,m$,s$,llx$,lly$,urx$,ury$
icon_getselect(epsffit%, 0) c$ = " -c"
c$=""
icon_getselect(epsffit%, 2) m$ = " -m"
m$=""
icon_getselect(epsffit%, 3) r$ = " -r"
r$=""
icon_getselect(epsffit%, 4) s$ = " -s"
s$=""
icon_getselect(epsffit%, 5) a$ = " -a"
a$=""
) llx$=" "+
icon_gettext(epsffit%, 6)
) lly$=" "+
icon_gettext(epsffit%, 8)
* urx$=" "+
icon_gettext(epsffit%, 10)
* ury$=" "+
icon_gettext(epsffit%, 12)
(llx$ = " ")
(lly$ = " ")
(urx$ = " ")
(ury$ = " ")
} fred% =
wimp_messagebox(
, "Warning", "EpsfFit: Must define x and y coords for lower left and upper right position")
F CL$(epsffitwin%) = "epsffit "+c$+r$+a$+m$+s$+llx$+lly$+urx$+ury$
psbook_CL
sig$
* sig$=" -s"+
icon_gettext(psbook%, 2)
sig$=" -s" sig$=""
& CL$(psbookwin%)="psbook -q"+sig$
psresize_CL
size$,minsize$
psize%(psresizewin%,0) = 0
3
get_pagesize( psresizewin%, 0, 5, X%, Y% )
- custom_page%(psresizewin%, 0, 0) = X%
- custom_page%(psresizewin%, 0, 1) = Y%
' size$ = " -w"+
(X%)+" -h"+
8 size$ = " -p"+
page_name(psize%(psresizewin%,0))
psize%(psresizewin%,1) = 0
4
get_pagesize( psresizewin%, 1, 13, X%, Y% )
- custom_page%(psresizewin%, 1, 0) = X%
- custom_page%(psresizewin%, 1, 1) = Y%
) insize$ = " -W"+
(X%)+" -H"+
: insize$ = " -P"+
page_name(psize%(psresizewin%,1))
6 CL$(psresizewin%)="psresize"+size$+insize$+" -q"
psselect_CL
e$,o$,r$,pages$
icon_getselect(psselect%, 0) e$ = " -e"
e$=""
icon_getselect(psselect%, 2) o$ = " -o"
o$=""
icon_getselect(psselect%, 3) r$ = " -r"
r$=""
. pages$=" -p"+
icon_gettext(psselect%, 4)
pages$=" -p" pages$=""
5 CL$(psselectwin%)="psselect -q"+e$+o$+r$+pages$
which_winnum(win%)
i% = 0
wins%(i%) = win% =i%
H fred%=
wimp_messagebox(
, "Error!", "Window not found somewhere!")
psnup_setup
psize%(psnupwin%, 1) = 7
icon_setcaret(psnup%, 3, -1)
psize%(psnupwin%, 0) = 7
%
icon_setcaret(psnup%, 5, -1)
&
icon_setcaret(psnup%, 27, -1)
pstops_setup
width%, height%
temp% 2048 :
Really temp?
% !pane% =
win_handle(topspane%)
"Wimp_GetWindowState",, pane%
# !temp% =
win_handle(pstops%)
"Wimp_GetWindowState",, temp%
pane%!28 = -1
H width% = (pane%!12 - pane%!4)/2 : height% = (pane%!16 - pane%!8)/2
' pane%!12 = width% + temp%!4 + 596
( pane%!16 = height% + temp%!8 + 218
& pane%!4 = temp%!4 + 596 - width%
' pane%!8 = temp%!8 + 218 - height%
temp%!28 = !pane%
&400C5,,pane%
psize%(pstopswin%, 0) = 7
&
icon_setcaret(pstops%, 5, -1)
'
icon_setcaret(pstops%, 10, -1)
get_pagesize(pstopswin%, 0, 5, pw%, ph%)
7 sc = 216/pw%: sc1 = 184/ph%:
(sc1 < sc) sc = sc1
pw% = pw% * sc: ph% = ph% * sc
epsffit_setup
icon_setcaret(epsffit%, 10, -1)
psbook_setup
icon_setcaret(psbook%, 2, -1)
psresize_setup
psize%(psresizewin%, 0) = 7
icon_setcaret(psresize%, 5, -1)
psize%(psresizewin%, 1) = 7
-(
icon_setcaret(psresize%, 13, -1)
psselect_setup
icon_setcaret(psselect%, 4, -1)
event_keypress(B%)
B%!24 <> &0D
8#
"Wimp_ProcessKey", B%!24
:" which% =
win_findwin(!B%)
icon_select(which%, 1)
x% = TIME
REPEAT UNTIL TIME = x%+15
which% = savewin%
?/ outfile$ =
icon_gettext(savewin%, 2)
@!
outfile$, ".") = 0
Aj hello%=
wimp_messagebox(
, "Warning from PSUtils","Drag the file icon to a directory to save")
D/
transfer_savefile(outfile$, &FF5, 0)
E
F&
Any of the config windows.
call_CL(which%)
mid_save%
K9
which_winnum(which%) = curr_selection%)
mid_save% =
M7
transfer_savefile(config_name$, &FF5, 0)
N4
Call the PROC to save the file .....
R!
icon_deselect(which%, 1)
S4
(which% = pstops%)
win_closewin(topspane%)
T<
win_closewin(which%) :
Close the window whatever.
event_closewindow(I%)
handle%, x%, y%, b%
win_findwin(!I%) = pstopsedit%)
x%, y%, b%
b% = 1
^K
An attempt to check if the right button was pressed at the time
_%
win_getsize(pstops%,x%,y%)
os_screensize(X%,Y%)
a5
win_movewin(pstops%,(X%-x%)
2,(Y%-y%)
b!
call_setup(pstopswin%)
c
d& !I% =
win_handle(pstopsedit%)
&400C6,,I%
big_page_open% =
g
win_findwin(!I%) = savewin%)
&400C6,,I%:
l! handle% =
win_findwin(!I%)
Not sure whether to include this?
mid_save%
which_winnum(handle%) = curr_selection%)
mid_save% =
PROCtransfer_savefile(config_name$, &FF5, 0)
REM Call the PROC to save the file .....
(handle% = pstops%)
t' !pane% =
win_handle(topspane%)
&400C6,,pane%
w !I% =
win_handle(handle%)
&400C6,,I%
event_openwindow(I%)
handle%, width%, height%
}! handle% =
win_findwin(!I%)
(handle% = pstops%)
' !pane% =
win_handle(topspane%)
(
"Wimp_GetWindowState",, pane%
- pane%!28 = -1 :
I%!28 : REM 216x184
I width% = (pane%!12 - pane%!4)/2: height% = (pane%!16 - pane%!8)/2
& pane%!12 = width% + I%!4 + 596
' pane%!16 = height% + I%!8 + 218
% pane%!4 = I%!4 + 596 - width%
& pane%!8 = I%!8 + 218 - height%
I%!28 = !pane%
&400C5,,pane%
&400C5,,I%
pagespecs(strin$)
num_pages, dplus%, rel_end%, pn%, l%, r%, u%, br%, sc%
bc%, bl%, scale, xoff, yoff, next%, pnext%
win_w%, win_h%, curr_page%
strin$, ":") = 0
spec$ = strin$
num_pages% = 1
1 num_pages% =
strin$,
strin$, ":")-1))
' spec$=
strin$,
strin$, ":")+1)
!pagespecs% = num_pages%
dplus% =
realloc(pagespecs%, num_pages%*20+4) :
20 bytes * number of pages
win_getsize(topspane%, win_w%, win_h%)
i% = 1
num_pages%
/ curr_page% = pagespecs% + (i%-1)*20 + 4
8 !curr_page% = 0 : ?(curr_page% + flags_off%) = 0
J |(curr_page% + scale_off%) = 0.0 : |(curr_page% + xoff_off%) = 0.0
( |(curr_page% + yoff_off%) = 0.0
Q
dplus% ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
fplus%
plus% =
spec$, "+")
comma% =
spec$, ",")
(comma% <> 0)
>
spec$, ")") > comma%)
spec$, "(") < comma%)
3 comma% =
spec$,
spec$, ")")+1), ",")
9
comma% <> 0 comma% = comma% +
spec$, ")")
<
((plus% < comma%)
(plus% <> 0))
(comma% = 0)
next% = plus%
dplus% =
next% = comma%
dplus% =
next% > 0
' next_page$ =
spec$, next%-1)
" spec$ =
spec$, next%+1)
) next_page$ = spec$ : spec$ = ""
!
next_page$, 1) = "-"
rel_end% =
4 next_page$ =
next_page$,
(next_page$)-1)
I ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
fend%
l% =
next_page$, "L")
r% =
next_page$, "R")
u% =
next_page$, "U")
sc% =
next_page$, "@")
bl% =
next_page$, "(")
@ pnext% = l% :
(pnext% > r%)
(pnext% = 0) pnext% = r%
2
(pnext% > u%)
(pnext% = 0) pnext% = u%
4
(pnext% > sc%)
(pnext% = 0) pnext% = sc%
4
(pnext% > bl%)
(pnext% = 0) pnext% = bl%
pnext% = 0
pn% =
(next_page$)
) pn% =
next_page$, pnext%-1))
!curr_page% = pn%
l% > 0
l% =
G ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
l% =
r% > 0
r% =
G ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
r% =
u% > 0
u% =
G ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
u% =
sc% = 0
scale = 1.0
( scale =
next_page$, sc%+1))
H ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
fsc%
, |(curr_page% + scale_off%) = scale
5
(bl% <> 0)
((bl% < next%)
(next% = 0))
% br$ =
next_page$, bl% + 1)
bc% =
br$, ",")
br% =
br$, ")")
@ x$ =
br$, 0, bc%-1): y$ =
br$, bc%+1, br% - bc% -1 )
xoff =
parse_dim(x$)
yoff =
parse_dim(y$)
I ?(curr_page% + flags_off%) = ?(curr_page% + flags_off%)
foff%
L |(curr_page% + xoff_off%) = xoff: |(curr_page% + yoff_off%) = yoff
&
spec$ = "" i% = num_pages%+1
Needed in structure:- Number: Page num (Integer , word)
Flags: l, r, u, sc, same_page, reverse, offset (byte)
Numbers: Scale, xoffset, yoffset (float multibyte)
Mem needed = 4 + 1 + 3*5 bytes = 20 bytes per page
event_redraw(B%)
more%, i%, lpw%, lph%, x%, y%, curr_page%, x, y, nw, nh, nw%, nh%, win%, rescale, blx%, bly%, col%
win% = !B%
win_findwin(win%)
topspane%:
rescale = sc
pstopsedit%
rescale = mag%/div%
"Wimp_RedrawWindow",,B%
more%
more%
<
Basically take what is currently in pagespecs% and
=
draw what you think is a reasonable representation!
col% = 11
"
i% = 0
(!pagespecs%-1)
- curr_page% = pagespecs% + i%*20 + 4
x = 0.0: y = 0
The order is:- Shift then Rotate then Scale
But I think it is really the other way around
Only scale the dimensions not the coords since they are still zero the hero
nw = pw%: nh = ph%
8
(?(curr_page% + flags_off%)
fsc%) = fsc%
. nw = nw*|(curr_page% + scale_off%)
. nh = nh*|(curr_page% + scale_off%)
angle% = 0
6
(?(curr_page% + flags_off%)
fl%) = fl%
angle% = angle% + 90
0
nh, nw: nw = -nw:
Well sort of!
6
(?(curr_page% + flags_off%)
fr%) = fr%
angle% = angle% - 90
0
nh, nw: nh = -nh:
Well sort of!
6
(?(curr_page% + flags_off%)
fu%) = fu%
! angle% = angle% + 180
nw = -nw: nh = -nh
!:
(?(curr_page% + flags_off%)
foff%) = foff%
"I x = |(curr_page% + xoff_off%) : y = |(curr_page% + yoff_off%)
$
font_setangle(angle%)
%. x = x*rescale: y = (y - ph%)*rescale
&* nh = nh*rescale: nw = nw*rescale
'I x% = x: y% = y:
Just centre the blob on the point of interest
nw% = nw: nh% = nh
blx% = x%: bly% = y%
*.
nw% < 0 x% = x% + nw% : nw% = -nw%
+.
nh% < 0 y% = y% + nh% : nh% = -nh%
,( nw% = x% + nw%: nh% = y% + nh%
pages%(i%,0) = x%
pages%(i%,1) = y%
pages%(i%,2) = nw%
pages%(i%,3) = nh%
16
coord_wintoreal(
win_findwin(win%), x%, y%)
2:
coord_wintoreal(
win_findwin(win%), blx%, bly%)
38
coord_wintoreal(
win_findwin(win%), nw%, nh%)
46 blx% = blx% + 8*
(nw): bly% = bly% + 8*
5=
(?(curr_page% + flags_off%)
fplus%) <> fplus%
col% = col% + 1
col%=16 col% = 8
9#
"Wimp_SetColour", col%
pages%(i%,5) = col%
;#
x%, y%, nw%-x%, nh%-y%
</
font_setcolour(&00000000, &FFFFFF00)
=;
font_plottext(
(!curr_page%), trin%, blx%, bly%)
>
!B% = win%
@*
"Wimp_GetRectangle",,B%
more%
get_pagesize(win%, one_two%, icon_start%,
w%,
dummy$, w$, h$
dummy$ = ""
psize%(win%,one_two%)
I6 w$ =
icon_gettext(wins%(win%), icon_start%)
J8 h$ =
icon_gettext(wins%(win%), icon_start%+1)
w% =
parse_dim(w$)
h% =
parse_dim(h$)
w% = 595: h% = 842
w% = 842: h% = 1191
w% = 421: h% = 595
w% = 516: h% = 729
w% = 612: h% = 792
w% = 612: h% = 1008
w% = 1224: h% = 792
w% = 792: h% = 1224
w% = 396: h% = 612
w% = 540: h% = 720
w% = 612: h% = 936
w% = 610: h% = 780
w% = 720: h% = 1008
parse_dim(
dim$)
c%, p%, i%, m%, u%, s%, error_cond%
error_cond% =
u% = 0
s% = 999
c% =
dim$, "c")
p% =
dim$, "p")
i% =
dim$, "i")
m% =
dim$, "m")
(c% <> 0) u% = 1 : s% = c%
(p% <> 0)
(p% < s%) u% = 2 : s% = p%
(i% <> 0)
(i% < s%) u% = 3 : s% = i%
(m% <> 0)
(m% < s%) u% = 4 : s% = m%
z( u% = 1: dim$ =
(dim$))+"pt"
=
(dim$)
}&
dim$, s%+1, 1) <> "m")
error_cond% =
* dim$ =
dim$, s%-1)))+"cm"
% =
dim$, s%-1))*72/2.54
&
dim$, s%+1, 1) <> "t")
error_cond% =
* dim$ =
dim$, s%-1)))+"pt"
=
dim$, s%-1))
&
dim$, s%+1, 1) <> "n")
error_cond% =
* dim$ =
dim$, s%-1)))+"in"
=
dim$, s%-1))*72
&
dim$, s%+1, 1) <> "m")
error_cond% =
* dim$ =
dim$, s%-1)))+"mm"
% =
dim$, s%-1))*72/25.4
error_cond%
dim$ = dim$
] fred% =
wimp_messagebox(
, "Error", "Error: Invalid dimension specifier somewhere!")
= 0
N fred% =
wimp_messagebox(
, "Error", "Can't finish this function here!")
page_name(page_num%)
page_num%
[ fred% =
wimp_messagebox(
, "Error", "Shouldn't have called page_name that way!")
= ""
= "a4"
= "a3"
= "a5"
= "b5"
= "letter"
= "legal"
= "ledger"
= "tabloid"
= "statement"
= "executive"
= "folio"
= "quarto"
= "10x14"
bigpage_click(B%)
l%,r%,b%,t%,x%,y%,w%,h%,i%
B% contains all details of the mouse click
Find where the click was and decide which page was clicked on.
x% = !B% : y% = B%!4
coord_realtowin( pstopsedit%, x%, y% )
hitwin% = -1
Find the window number (logical number rather than physical - make sense?)
i% = 0
!pagespecs%-1
Check L, R, T and then B
( ( y% >= pages%(i%,1) )
( y% < pages%(i%,3) ) )
O
( x% - pages%(i%,0) ) <= 4 )
( x% - pages%(i%,2) ) < 4 ) )
' hitwin%=i% : i% = !pagespecs%
( ( x% >= pages%(i%,0) )
( x% < pages%(i%,2) )
( hitwin% = -1 ) )
O
( y% - pages%(i%,1) ) <= 4 )
( y% - pages%(i%,3) ) < 4 ) )
' hitwin%=i% : i% = !pagespecs%
hitwin% = -1
Possibly un highlight the previously selected window of something like that
hello% = FNwimp_messagebox( FALSE, "Selected page", "Page number "+STR$(hitwin%)+" selected "+STR$(B%!8) )
"Wimp_SetColour", 0+(3<<4)
l% = pages%(i%,0)
"r% = pages%(i%,2)-pages%(i%,0)
b% = pages%(i%,1)
"t% = pages%(i%,3)-pages%(i%,1)
$!B% =
win_handle( pstopsedit% )
7B%!4 = l% : B%!8 = t% : B%!12 = r%+2 : B%!16 = b%-2
&400C9,,B%
more%
coord_wintoreal( pstopsedit%, l%, b% )
coord_wintoreal( pstopsedit%, r%, t% )
more%
l%,b%,r%-l%,t%-b%
&400CA,,B%
more%
memory(Y%,S%)
P%,D%,A%,B%,C%,E%,F%,G%,H%,I%,J%,K%,L%,M%,N%,O%,Q%,R%,T%,U%,V%,Z%,X%,W%
copyright$,g%,h%,i%,l%,m%,n%,o%
Gcopyright$="Dynamic memory allocation routines,
Ian Palmer, 1993"
_mem_code% 559
0_mem_error%=Y%:_memdim%=S%:
&51
_mpsize%
&400EC,-1,-1
_mtop%:_mtop%+=&8000
Z%=0
2:P%=_mem_code%:[OPT Z%
!B A%:B B%:B C%:B D%:B R%:B W%
H.A%:ADR R4,_memory%:LDR R1,[R4]:.E%:CMP R1,#0:BEQ F%:LDR R2,[R1,#-4]
LCMP R2,R0:BGE G%:MOV R4,R1:LDR R1,[R1]:B E%:.F%:MOV R0,#0:ADR R1,_memrv%
ESTR R0,[R1]:MOV PC,R14:.G%:LDR R2,[R1]:STR R2,[R4]:ADR R0,_memrv%
STR R1,[R0]:MOV PC,R14
M.B%:LDR R5,[R0,#-4]:ADD R6,R5,R0:ADD R6,R6,#4:ADR R4,_memory%:LDR R1,[R4]
B.H%:CMP R1,#0:BEQ I%:LDR R2,[R1,#-4]:ADD R3,R2,R1:ADD R3,R3,#4
QCMP R3,R0:BEQ J%:CMP R6,R1:BEQ K%:CMP R1,R0:BGT I%:MOV R4,R1:LDR R1,[R1]:B H%
B.I%:STR R0,[R4]:STR R1,[R0]:B L%:.J%:ADD R5,R5,R2:ADD R5,R5,#4
JSTR R5,[R1,#-4]:MOV R0,R1:LDR R1,[R1]:CMP R6,R1:BNE L%:LDR R2,[R1,#-4]
I.K%:ADD R5,R5,R2:ADD R5,R5,#4:STR R5,[R0,#-4]:LDR R1,[R1]:STR R1,[R0]
9STR R0,[R4]:.L%:ADR R1,_memrv%:STR R0,[R1]:MOV PC,R14
I.C%:ADR R1,_memory%:.M%:LDR R2,[R1]:CMP R2,#0:BEQ N%:CMP R2,R0:BEQ O%
NMOVLT R1,R2:BLT M%:.N%:MOV R1,#0:.O%:ADR R0,_memrv%:STR R1,[R0]:MOV PC,R14
H.R%:ADR R4,_memory%:LDR R2,[R4]:.T%:CMP R2,#0:BEQ U%:LDR R3,[R2,#-4]
JADD R3,R3,R2:CMP R3,R0:BEQ V%:MOV R4,R2:LDR R2,[R2]:B T%:.U%:MOV R2,#0
I.V%:ADR R1,_memrv%:STR R2,[R1]:ADR R1,_memrv2%:STR R4,[R1]:MOV PC,R14
B.W%:ADR R1,_memory%:MOV R0,#0:LDR R2,[R1]:.Y%:CMP R2,#0:BEQ S%
1LDR R3,[R2,#-4]:ADD R0,R0,R3:LDR R2,[R2]:B Y%
-.S%:ADR R1,_memrv%:STR R0,[R1]:MOV PC,R14
B.D%:STMFD R13!,{R8-R10,R14}:CMP R0,#0:LDMEQFD R13!,{R8-R10,PC}
-CMP R1,R2:LDMEQFD R13!,{R8-R10,PC}:BLT l%
H.g%:SUBS R0,R0,#32:BLT h%:LDMIA R1!,{R3-R10}:STMIA R2!,{R3-R10}:B g%
Q.h%:ADDS R0,R0,#32:.i%:LDMEQFD R13!,{R8-R10,PC}:LDR R4,[R1],#4:STR R4,[R2],#4
SUBS R0,R0,#4:B i%
!.l%:ADD R1,R1,R0:ADD R2,R2,R0
H.m%:SUBS R0,R0,#32:BLT n%:LDMDB R1!,{R3-R10}:STMDB R2!,{R3-R10}:B m%
D.n%:ADDS R0,R0,#32:.o%:LDMEQFD R13!,{R8-R10,PC}:LDR R4,[R1,#-4]!
'STR R4,[R2,#-4]!:SUBS R0,R0,#4:B o%
._memory% EQUD 0
._memrv% EQUD 0
._memrv2% EQUD 0
_more_memory(S%)
M%,L%,A%,X%,Y%,Z%:M%=0
_memdim%
M A%=
_mem_code%+16:L%=!_memrv%:
L%<>0
S%-=!(L%-4)-4:!!_memrv2%=!L%
S%<(
-2048)
M% S%-1:!M%=S%-4:
L%<>0
M%=L%-4:!M%=S%+!(L%-4)
T A%=_mtop%:
_mem_code%+16:L%=!_memrv%:
L%<>0
S%-=!(L%-4)-4:!(!_memrv2%)=!L%
&400EC,-1,-1
X%,Y%,Z%:
S%<Z%
k
&400EC,X%+S%,Y%
Z%:M%=X%+&8000:!M%=Z%-X%-4:_mtop%=Z%+&8000:
L%<>0
M%=L%-4:!M%=Z%-X%+!(L%-4)
M%<>0
M%+=4
_less_memory
A%,B%,L%,C%,S%,N%,D%
A%=_mtop%:
_mem_code%+16
)+B%=!_memrv%:C%=!_memrv2%:B%-=4:L%=4+!B%
*;D%=(L%
_mpsize%)*_mpsize%:N%=L%-D%:S%=_mtop%-D%-&8000
&400EC,S%,-1
S%:_mtop%=S%+&8000
N%>7
!B%=N%-4:
!C%=0
font_init
02__font_angle=0:__font_xflip%=
:__font_yflip%=
__font_transform% 24,__font_bbox% 36
24__font_transform%!0=&10000:__font_transform%!4=0
35__font_transform%!8=0:__font_transform%!12=&10000
41__font_transform%!16=0:__font_transform%!20=0
_font_settransform
80__font_transform%!0=
(__font_angle)*&10000
90__font_transform%!4=
(__font_angle)*&10000
:1__font_transform%!8=-
(__font_angle)*&10000
;1__font_transform%!12=
(__font_angle)*&10000
__font_xflip% __font_transform%!8=-(__font_transform%!8):__font_transform%!12=-(__font_transform%!12)
__font_yflip% __font_transform%!0=-(__font_transform%!0):__font_transform%!4=-(__font_transform%!4)
grj_wimp_init(T$,I$,L%,S%,V%,H%)
grj_name% 256, grj_valid% 256
B%,C%,X%,Y%,M%,xp%,yp%,wfhand%:
S%=0
S%=512:
S%<256 S%=256
CS_wimp_task$=T$:_wimp_buffer%=
malloc(S%):B%=
malloc(38+
(I$)):_wimp_iconbar%=B%
&400C0,V%,&4B534154,T$,H%
_wimp_version%,_wimp_handle%
font_init
This is needed for the iconbar text initialsation
&20023,"Wimp$Font",_wimp_buffer%,S%,0,0
,,len%,,type% ; NoFont%
( NoFont%
1 ) = 0
I ?(_wimp_buffer%+len%) = 13
wfname$ = $_wimp_buffer%
xp% =
wfname$, "\F" )
( xp% <> 0 ) wfname$ =
wfname$, xp%+2 )
xp% =
wfname$, "\E" )
( xp% <> 0 ) wfname$ =
wfname$, 0, xp%-1 )
&23,"Wimp$FontWidth",_wimp_buffer%,S%,0,0
,,len%,,type%
P ?(_wimp_buffer%+len%) = 13
temp$ = $_wimp_buffer%
yp%=
(temp$)
$_wimp_buffer% = wfname$
T% ?(_wimp_buffer%+
(wfname$)) = 0
&40081,,_wimp_buffer%,yp%,yp%,0,0
wfhand%
I$<>""
&400E9,40,,I$
,,,X%,Y%,,M%
&35,M%,4
,,C%:X%=X%<<C%
&35,M%,5
,,C%:Y%=Y%<<C%
( NoFont%
1 ) = 0
\E
&40085,,"PsResize",&7FFFFFFF,&7FFFFFFF,-1,&7FFFFFFF
,,X%
&40088,,X%,Y%
X% = 128
!B%=-2:
!B%=-1
GRJ - CHANGE FOR PSUTILS!
B%!4=0:B%!8=-16 :
was 0
d% B%!12=X%:B%!16=Y%+20 :
was Y%
e" B%!20=&1700210B :
was 2102
f! B%!24=grj_name% :
B%+36+1
g# B%!28 = grj_valid% :
B%+36:
B%!32=
(I$)+1
$(B%+36)="s"+I$
$(grj_name%) = I$
$(grj_valid%) = "s"+I$
B%!28=1:B%!32=LEN(I$)+1
&400C2,,B%
_wimp_icon%
( NoFont%
1 ) = 0
&40082,wfhand%
grj_update_bartext(T$)
B%,C%,X%,Y%,M%
B%=_wimp_buffer%
Lets try to get thewidth of the string - somewhat assumescurent font is
desktop font
$(grj_name%) = T$
z, !B%=-1:B%!4=_wimp_icon%:B%!8=0:B%!12=0
&400CD,,B%
wimp_error(F%,E%,M$)
B%,R%:B%=_wimp_buffer%
%!B%=E%:$(B%+4)=M$:?(B%+4+
(M$))=0
&400DF,B%,1,_wimp_task$
wimp_quit
&400DF,B%,3,_wimp_task$
R%=2
wimp_quit
*|update
wimp_quit:
*** update block ***
I%=0
_temp_fonts%?I%
"Font_LoseFont",I%
&400DD,_wimp_handle%,&4B534154
*|downdate
malloc(A%)
M%,S%
-S%=A%:A%=12+(A%
16)*16:
A%<S%
A%+=16
_mem_code%:M%=!_memrv%
M%=0
M%=
_more_memory(A%+4)
M%<>0
S%=!(M%-4):
S%-A%>15
!(M%-4)=A%:
add_free(M%+A%,S%-A%)
M%=0
_mem_error%
11,"Can't allocate memory"
win_init(E%)
4_win_list%=
malloc(4*E%):E%=
size_of(_win_list%)
A%=0
E%-1
4:!(_win_list%+A%)=0:
font_gethandle(font$,x,y)
font%
"Font_FindFont",,font$,x*16,y*16,0,0
font%
=font%
temp_init
_temp_list%=0
_temp_spritearea%=0
_temp_fonts%=
malloc(256)
I%=0
255:_temp_fonts%?I%=0:
*|update
transfer_init
_transfer_type%=0
_transfer_file$=""
_transfer_size%=0
_transfer_ref%=0
_transfer_dragging%=
_wimp_buffer%!0=1
_wimp_buffer%!4=2
_wimp_buffer%!8=3
_wimp_buffer%!12=5
_wimp_buffer%!16=6
_wimp_buffer%!20=7
_wimp_buffer%!24=&80142
_wimp_buffer%!28=&80144
_wimp_buffer%!32=&80145
_wimp_buffer%!36=0
wimp_addmessages(_wimp_buffer%)
_transfer_wantmess(mess%)
mess%
1,2,3,5,6,&80144,&80145: =
event_transfermessage(block%)
buffer%,size%,mess%
?(block%+!block%)=0
block%!16
F
transfer_willload(block%!40,
block%!8<>_transfer_ref%
1
os_putstring(block%+44,"<Wimp$Scrap>")
block%!36=-1
block%!12=block%!8
block%!16=2
!block%=60
2
"Wimp_SendMessage",17,block%,block%!4
$
block%!12=_transfer_ref%
# block%!36=_transfer_size%
block%!12=block%!8
block%!16=3
=
"Wimp_SendMessage",18,block%,block%!20,block%!24
V
transfer_savefile(
os_getstring(block%+44),_transfer_type%,(block%!36<>-1))
! _transfer_ref%=block%!8
menu_remove
E
block%!4<>_wimp_handle%
transfer_willload(block%!40,
block%!12=block%!8
block%!16=4
2
"Wimp_SendMessage",17,block%,block%!4
i
transfer_loadfile(
os_getstring(block%+44),block%!40,
os_getstring(block%+44)<>"<Wimp$Scrap>")
+
transfer_willload(block%!40,
block%!12=block%!8
block%!16=4
2
"Wimp_SendMessage",17,block%,block%!4
B
transfer_loadfile(
os_getstring(block%+44),block%!40,
&80145:
block%!12
_transfer_wantack(mess%)
mess%
3,7,&80142: =
event_transferacknowledge(block%)
dummy%
block%!16
#
block%!8=_transfer_ref%
5
os_getstring(block%+44)="<Wimp$Scrap>"
-
"OS_CLI","Remove <Wimp$Scrap>"
d dummy%=
wimp_messagebox(
,"Error from "+_wimp_task$,"Data transfer failed: Receiver died")
event_savedrag(block%)
flag%
_wimp_version%>=300
"OS_Byte",161,28
,,flag%
flag%=((flag%
2) = 2)
flag%=
flag%
"DragASprite_Stop"
"Wimp_DragBox",,-1
_transfer_dragging%=
_transfer_file$,".")
? _transfer_file$=
_transfer_file$,
_transfer_file$,".")+1)
"Wimp_GetPointerInfo",,_wimp_buffer%
G_wimp_buffer%!20=_wimp_buffer%!12:_wimp_buffer%!24=_wimp_buffer%!16
D_wimp_buffer%!28=!_wimp_buffer%:_wimp_buffer%!32=_wimp_buffer%!4
!$_wimp_buffer%!36=_transfer_size%
"$_wimp_buffer%!40=_transfer_type%
os_putstring(_wimp_buffer%+44,_transfer_file$)
$)_wimp_buffer%!12=0:_wimp_buffer%!16=1
%4!_wimp_buffer%=44+4*((
(_transfer_file$)+4)
"Wimp_SendMessage",18,_wimp_buffer%,_wimp_buffer%!20,_wimp_buffer%!24
'"_transfer_ref%=_wimp_buffer%!8
*|downdate
*|update
wimp_poll(M%,T%,P%):
*** update block ***
R%,I%,Q%
T%=0
&400C7,M%,_wimp_buffer%,,P%
&42
Q%:Q%=Q%+T%
&400E1,M%,_wimp_buffer%,Q%,P%
:I%=_wimp_buffer%
1 :
event_redraw(I%)
2 :
event_openwindow(I%)
3 :
event_closewindow(I%)
6 :
I%!12=-2
Q%=I%!8
95
(Q%
event_iconbarmenu(!I%)
:6
(Q%
event_iconbaradjust(I%)
;6
(Q%
event_iconbarselect(I%)
Q%=0
>-
Q%=0
event_mouseclick(I%)
7 :
_transfer_dragging%
A$
event_savedrag(I%)
8 :
event_keypress(I%)
9 :
event_menuselection(I%):
menu_keepopen
17,18:
_transfer_wantmess(I%!16)
F.
event_transfermessage(I%)
H&
event_message(I%)
19:
_transfer_wantack(I%!16)
K/
event_transferacknowledge(I%)
*|downdate
temp_readfile(F$,E%)
C%,A%,D%,N%,T%,F%,Z%,H%,I%
C%=0
wimp_error(1,214,"Can't open template file "+F$)
A%=0
15:D%=
:T%=0:Z%=
malloc(E%)
A%=0
23:Z%?A%=
!Z%
X+ N%=
malloc(32):!N%=T%:T%=N%:N%!4=Z%!4
A%=0
11:F%=?(Z%+12+A%):
F%=0
?(Z%+A%+12)=13
:?(Z%+24)=13:$(N%+16)=
tolower($(Z%+12))
!Z%=0:
D%=T%:A%=Z%
malloc(256)
&400D9,,F$
I%=0
255:H%?I%=0:
I%
N%=
malloc(D%!4):D%!8=N%
&400DB,,N%,A%,A%+E%,H%,$(D%+16),0
,,C%:F%=4+C%-A%
dB C%=
malloc(F%):D%!12=C%:
&400DB,,N%,C%,C%+F%,H%,$(D%+16),0
!D%=0
!D%=_temp_list%:_temp_list%=T%:D%=0:
D%=!D%
I%=0
g$
H%?I%
_temp_fonts%?I%+=1
_temp_spritearea%
N%!64=_temp_spritearea%
I%=N%!84
I%>0
m+
(!(N%+104+32*I%)
&103)=&102
n- !(N%+112+32*I%)=_temp_spritearea%
I%-=1
q
&400DA:
free(Z%)
free(H%)
win_createwin(N$)
z(D%=
temp_copy(N$):
win_createwin(D%)
win_resize(W%,X%,Y%)
B%:B%=_wimp_buffer%:!B%=!(W%-8)
&400CB,,B%:B%!12=B%!4+X%:B%!16=B%!8+Y%:
&400C5,,B%
win_closewin(W%)
3!_wimp_buffer%=!(W%-8):
&400C6,,_wimp_buffer%
icon_shade(W%,I%)
-!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%
4_wimp_buffer%!8=&400000:_wimp_buffer%!12=&400000
&400CD,,_wimp_buffer%
icon_settext(W%,I%,T$)
cw%,ci%,cx%,cy%,cp%
F!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%:
&400CE,,_wimp_buffer%
(_wimp_buffer%!24
1)=0
(_wimp_buffer%!24
256)
os_putstring(_wimp_buffer%!28,
T$,_wimp_buffer%!36))
&400D3,,_wimp_buffer%+128
Ecw%=_wimp_buffer%!128:ci%=_wimp_buffer%!132:cx%=_wimp_buffer%!136
/cy%=_wimp_buffer%!140:cp%=_wimp_buffer%!148
cw%=W%!-8
ci%=I%
cp% >
(S$)
cp% =
&400D2,cw%,ci%,cx%,cy%,-1,cp%
(_wimp_buffer%!8=0:_wimp_buffer%!12=0
&400CD,,_wimp_buffer%
menu_init(N%)
;menu_tick=1:menu_dotted=2:_wimp_menu%=
malloc((N%+1)*4)
2_wimp_oldmenu%=0:_wimp_oldmx%=0:_wimp_oldmy%=0
7!_wimp_menu%=N%:
A%=1
N%:!(_wimp_menu%+4*A%)=0:
menu_header(T$,M%,N%)
P%,A%
P%=!(_wimp_menu%+4*(M%+1))
P%=0
5 P%=
malloc(32+24*N%):!(_wimp_menu%+4*(M%+1))=P%
size_of(P%)<(32+24*N%)
realloc(P%,32+24*N%):!(_wimp_menu%+4*(M%+1))=P%
F$P%=T$:P%?
(T$)=0:P%!12=&70207:P%!16=16*(1+
(T$)):P%!20=44:P%!24=0
A%=0
N%-2:!(P%+28+A%*24)=0:
:!(P%+4+N%*24)=128
menu_additem(M%,N%,I$,F%)
P%,W%
MP%=!(_wimp_menu%+4*(M%+1)):
P%=0
0,"Menu number "+
(M%)+" undefined"
@!(P%+28+N%*24)=(!(P%+28+N%*24)
&F0)
F%:!(P%+32+N%*24)=-1
D!(P%+36+N%*24)=&7000021:$(P%+40+N%*24)=I$:?(P%+40+N%*24+
(I$))=0
)W%=16*(1+
(I$)):
W%>P%!16
P%!16=W%
menu_submenu(M%,N%,S%)
P%:P%=!(_wimp_menu%+4*(M%+1))
&!(P%+28+N%*24)=!(P%+28+N%*24)
*!(P%+32+N%*24)=!(_wimp_menu%+4*(S%+1))
menu_subwindow(M%,N%,S%)
P%:P%=!(_wimp_menu%+4*(M%+1)):!(P%+32+N%*24)=!(S%-8)
toupper(S$)
R$,A%,C%,L%:L%=
(S$):R$="":
L%=0
A%=1
L%:C%=
S$,A%,1)):
C%>96
C%<123
C%-=32
(C%):
menu_untick(M%,N%)
P%:P%=!(_wimp_menu%+4*(M%+1))+28+N%*24:!P%=!P%
&FFFFFFFE
menu_tick(M%,N%)
P%:P%=!(_wimp_menu%+4*(M%+1))+28+N%*24:!P%=!P%
icon_unshade(W%,I%)
-!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%
._wimp_buffer%!8=0:_wimp_buffer%!12=&400000
&400CD,,_wimp_buffer%
win_getsize(W%,
B%:B%=_wimp_buffer%:!B%=!(W%-8)
&400CB,,B%:X%=B%!12-B%!4:Y%=B%!16-B%!8
os_screensize(
F%,P%
&35,-1,4
,,F%:
&35,-1,11
,,P%:X%=P%<<F%
&35,-1,5
,,F%:
&35,-1,12
,,P%:Y%=P%<<F%
win_movewin(W%,X%,Y%)
x%,y%,B%:B%=_wimp_buffer%:!B%=!(W%-8)
&400CB,,B%:x%=B%!12-B%!4:y%=B%!16-B%!8
+B%!4=X%:B%!8=Y%:B%!12=X%+x%:B%!16=Y%+y%
&400C5,,B%
win_handle(W%)
=!(W%-8)
win_getextent(W%,
B%:B%=_wimp_buffer%:!B%=!(W%-8)
&400CC,,B%:x%=B%!44:y%=B%!48:X%=B%!52:Y%=B%!56
icon_setcaret(W%,I%,X%)
X%=-1
icon_gettext(W%,I%))
&400D2,!(W%-8),I%,0,0,-1,X%
transfer_startdrag(file$,type%,size%,win%,icon%)
flag%,xmin%,xmax%,ymin%,ymax%,xsize%,ysize%,sprite$
$!_wimp_buffer%=
win_handle(win%)
"Wimp_GetWindowInfo",,_wimp_buffer%
8xmin%=_wimp_buffer%!4+!(_wimp_buffer%+92+32*icon%+0)
8xmax%=_wimp_buffer%!4+!(_wimp_buffer%+92+32*icon%+8)
[ymin%=_wimp_buffer%!8+!(_wimp_buffer%+92+32*icon%+4)+(_wimp_buffer%!16-_wimp_buffer%!8)
\ymax%=_wimp_buffer%!8+!(_wimp_buffer%+92+32*icon%+12)+(_wimp_buffer%!16-_wimp_buffer%!8)
os_screensize(xsize%,ysize%)
_wimp_version%>=300
"OS_Byte",161,28
,,flag%
flag%=((flag%
2) = 2)
flag%=
flag%
_wimp_buffer%!0=xmin%
_wimp_buffer%!4=ymin%
_wimp_buffer%!8=xmax%
_wimp_buffer%!12=ymax%
H sprite$="file_":
type%<&100 sprite$+="0":
type%<&10 sprite$+="0"
sprite$+=
~(type%)
"DragASprite_Start",%11000101,1,sprite$,_wimp_buffer%,0
!_wimp_buffer%=0
_wimp_buffer%!4=5
2 _wimp_buffer%!8=xmin%:_wimp_buffer%!12=ymin%
3 _wimp_buffer%!16=xmax%:_wimp_buffer%!20=ymax%
+ _wimp_buffer%!24=0:_wimp_buffer%!28=0
5 _wimp_buffer%!32=xsize%:_wimp_buffer%!36=ysize%
"Wimp_DragBox",,_wimp_buffer%
_transfer_type%=type%
_transfer_file$=file$
_transfer_size%=size%
_transfer_dragging%=
icon_gettext(W%,I%)
F!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%:
&400CE,,_wimp_buffer%
(_wimp_buffer%!24
1)=0
(_wimp_buffer%!24
256)
os_getstring(_wimp_buffer%!28)
wimp_messagebox(C%,T$,M$)
B%,R%,F%:B%=_wimp_buffer%:F%=17:
F%=19
$!B%=0:$(B%+4)=M$:?(B%+4+
(M$))=0
&400DF,B%,F%,T$
win_findwin(H%)
E%,A%,F%,P%
%DE%=
size_of(_win_list%):F%=-1:
A%=0
E%-1
4:P%=_win_list%!A%
P%<>0
!(P%-8)=H%
F%=P%
win_redrawwin(W%)
x1%,y1%,x2%,y2%
!_wimp_buffer%=W%!-8
"Wimp_GetWindowState",,_wimp_buffer%
x1%=_wimp_buffer%!20
y2%=_wimp_buffer%!24
/0x2%=x1%+(_wimp_buffer%!12)-(_wimp_buffer%!4)
00y1%=y2%+(_wimp_buffer%!8)-(_wimp_buffer%!16)
"Wimp_ForceRedraw",W%!-8,x1%,y1%,x2%,y2%
menu_popup(M%,X%,Y%)
5P_wimp_oldmenu%=M%:_wimp_oldmx%=X%:_wimp_oldmy%=Y%:M%=!(_wimp_menu%+4*(M%+1))
&400D4,,M%,X%,Y%
icon_getselect(W%,I%)
:F!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%:
&400CE,,_wimp_buffer%
(_wimp_buffer%!24
&200000)
win_setextent(W%,x%,y%,X%,Y%)
B%,O%,w%,h%:B%=_wimp_buffer%
!B%=W%!-8
"Wimp_GetWindowState",,B%
:w%=X%-x%:h%=Y%-y%
w% < B%!20+(B%!12-B%!4)
O%=
B%!20 = w%-(B%!12-B%!4)
B%!20<0
(B%!12-B%!4)>w%
B%!20 = 0
B%!12 = B%!4 + w%
h% < (B%!16-B%!8)-B%!24
O%=
B%!24 = (B%!16-B%!8)-h%
B%!24>0
(B%!16-B%!8)>h%
B%!24 = 0
B%!8 = B%!16 - h%
"Wimp_OpenWindow",,B%
T8!B%=x%:B%!4=y%:B%!8=X%:B%!12=Y%:
&400D7,!(W%-8),B%
icon_select(W%,I%)
X-!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%
Y4_wimp_buffer%!8=&200000:_wimp_buffer%!12=&200000
&400CD,,_wimp_buffer%
icon_deselect(W%,I%)
^-!_wimp_buffer%=!(W%-8):_wimp_buffer%!4=I%
_._wimp_buffer%!8=0:_wimp_buffer%!12=&200000
&400CD,,_wimp_buffer%
realloc(
P%,N%)
A%,B%,C%
P%=0
malloc(N%):
f8C%=!(P%-4):B%=N%:N%=12+(N%
16)*16:
N%<B%
N%+=16
N%<=C%
(C%-N%)>15
!(P%-4)=N%:
add_free(P%+N%,C%-N%)
jL A%=P%+C%+4:
_mem_code%+8:B%=!_memrv%:A%=0:
B%<>0
B%=!B%:A%=!(B%-4)
B%<>0
C%+A%+4>=N%
l% !!_memrv%=!B%:!(P%-4)=C%+A%+4
A%=C%:C%=
malloc(N%)
C%<>0
p/ B%=P%:
_mem_code%+12:
free(P%):P%=C%
q
r6
_mem_error%
11,"Can't allocate memory"
s
font_setangle(theta)
__font_angle=theta
_font_settransform
coord_wintoreal(W%,
B%:B%=_wimp_buffer%
!B%=!(W%-8):
&400CB,,B%
&X%=X%-B%!20+B%!4:Y%=B%!16-B%!24+Y%
font_setcolour(fore%,back%)
"ColourTrans_SetFontColours",0,back%,fore%,14
font_plottext(text$,font%,x%,y%)
x% = x% * 400
y% = y% * 400
"Font_Paint",font%,text$,%01111000000,x%,y%,,__font_transform%,
text$
coord_realtowin(W%,
B%:B%=_wimp_buffer%
!B%=!(W%-8):
&400CB,,B%
&X%=X%+B%!20-B%!4:Y%=Y%+B%!24-B%!16
add_free(A%,L%)
:L%=(L%
16)*16:
L%>0
!A%=L%-4:A%+=4:
_mem_code%+4
size_of(P%)
=!(P%-4)
wimp_addmessages(M%)
"Wimp_AddMessages",M%
os_putstring(P%,S$)
$P%=S$:?(P%+
(S$))=0
os_getstring(P%)
S$:S$="":
?P%>31 S$+=
(?P%):P%+=1:
menu_remove
"Wimp_CreateMenu",,-1
event_iconbarmenu(X%)
Y%,M%:
wimp_error(1,
$+" at line "+
wimp_mainmenu:Y%=96+
menu_menuheight(M%):X%-=16+(
menu_width(M%)
menu_popup(M%,X%,Y%)
menu_keepopen
_wimp_oldmenu%=-1
*M%=!(_wimp_menu%+4*(_wimp_oldmenu%+1))
&400CF,,_wimp_buffer%
(_wimp_buffer%!8
&400D4,,M%,_wimp_oldmx%,_wimp_oldmy%
event_message(B%)
B%!16
0 :
wimp_quit
tolower(S$)
R$,A%,C%,L%:L%=
(S$):R$="":
L%=0
A%=1
L%:C%=
S$,A%,1)):
C%>64
C%<91
C%+=32
(C%):
free(A%)
_mem_code%+4:L%=!_memrv%
(L%+!(L%-4))=_mtop%
(4+!(L%-4))>=_mpsize%
_less_memory
temp_copy(N$)
F%,P%,S%,A%,T%,D%,L%,N%,B%,C%,I%
'F%=0:P%=_temp_list%:N$=
tolower(N$)
$(P%+16)=N$
F%=P%
P%=!P%
F%=0
wimp_error(1,0,"Can't locate template "+N$)
size_of(F%!8):P%=
malloc(S%+20)+16:T%=F%!8:!(P%-16)=&76C0000:!(P%-12)=0
A%=0
S%-1
4:!(P%+A%+4)=T%!A%:
size_of(F%!12)
malloc(S%):!(P%-4)=D%:!(P%-8)=0:!P%=P%+4
(T%!56)
256
L%=T%!80:
A%=0
L%-1
4:D%!A%=!(T%!72+A%):
:!(P%+72+4)=D%:D%+=L%
N%=T%!84:
N%=0
B%=0
N%-1:I%=!(T%+104+32*B%)
(I%
256)<>0
((I%
1)<>0
(I%
2)<>0)
) C%=108+32*B%:L%=!(T%+C%+8):
L%>0
-
A%=0
L%-1
4:D%!A%=!(A%+T%!C%):
G !(P%+C%+4)=D%:!(P%+C%+12)=L%:D%+=L%:!(P%+C%+8)=-1:A%=!(T%+C%+4)
b
(I%
1)<>0
A%>1
!(P%+C%+8)=D%:T$=
os_getstring(A%):
os_putstring(D%,T$):D%+=1+
win_createwin(D%)
W%,A%,E%,F%
!(D%-8)<>0
wimp_error(1,0,"Trying to create a window that's already there")
&400C1,,!D%
W%:!(D%-8)=W%
size_of(_win_list%):F%=-1:
A%=0
E%-1
_win_list%!A%=0
F%=A%
F%=-1
realloc(_win_list%,E%+16):F%=E%:
A%=E%
E%+15
4:_win_list%!A%=0:
_win_list%!F%=D%
menu_menuheight(N%)
A%,H%,P%:N%+=1:P%=!(_wimp_menu%+4*N%):H%=0:A%=-1:
:A%+=1
*H%+=44:
(!(P%+A%*24+28)
H%+=22
(!(P%+A%*24+28)
128)
menu_width(N%)
P%:P%=!(_wimp_menu%+(N%+1)*4)
=P%!16